//密码收费退费
import React from 'react';
import { Select, Input, Row, Col, Divider, message, Icon, Radio } from 'antd';
import { Keup } from '../../../../tools/index';
import { $http } from 'containers/config/https';
import OtherCashRegister from './js/OtherCashRegister.jsx';
import '../style/style.less';

// 组件const
const { Option } = Select;

export default class PatPayModal extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            otherPayData: [], //其他付款方式
            disXJ: false, //现金的显示隐藏
            dis1: false, //单一的显示隐藏
            ynDis: false, //院内账户的显示隐藏
            hzDis: false, //合作医院的显示隐藏
            dxDis: false, //多选的显示隐藏
            payType: '',  //支付方式
            otherPay: '',  //其他支付方式
            unitsList: [], // 合作单位列表
            unitsListVal: '', //合作单位
            radio: 1,//单选
            otherPayMoney: '0.00', // 其他支付金额
            cashInCashVal: '0.00', // 支付金额
            otherPay2: undefined,  //其他支付方式
            otherPayMoney2: '0.00', // 其他支付金额
            xJ: '', // 实付现金金额
            zeroPay: '0.00', // 找零金额
            maypayData: [],// 循环数据
            moneyData: {}, // 金额数据
            chargeRecodeId: '',// 付款id
            patID: '', //patID
            accPurPoseList: '',
            payableAmt: 0
        }
        this.myRef1 = React.createRef();
        this.myRef2 = React.createRef();
        this.myRef3 = React.createRef();
        this.myRef4 = React.createRef();
        this.myRef5 = React.createRef();
        this.myRef6 = React.createRef();
        this.myRef7 = React.createRef();
    }

    componentDidMount() {
        // 权限
        this.initJuris()
        this.unitsList() //合作单位
        this.setState({
            chargeRecodeId: this.props.chargeRecodeId || '',
            patID: this.props.patID || '',
            accPurPoseList: '',
        }, () => {
            this.maypay(this.state.chargeRecodeId)  //maypay
            // this.money(this.state.chargeRecodeId)  //maypay
        })

        this.props.onRef(this)
        setTimeout(() => {
            this.myRef1.current.focus();
        }, 300)
    }

    // 合作单位
    unitsList = () => {
        let data = {
            params: [{
                "code": "",
                "desc": '',
            }]
        }
        $http.post('urlS', this, {
            code: "01040060",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    this.setState({
                        unitsList: res.contractUnit, // 合作单位
                    });
                }
            }
        });
    }

    // 权限
    initJuris = () => {
        var data = {
            params: [{
                logonHospID: JSON.parse(window.sessionStorage.userData).hospID, //医院id 
                logonGroupID: JSON.parse(window.sessionStorage.userData).groupID,  //角色id
                logonUserID: JSON.parse(window.sessionStorage.userData).userID, //人员id
                invTypeCode: 'O'  // 类型
            }]
        }
        $http.post('urlS', this, {
            code: "05210001",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {

                    this.setState({
                        otherPayData: res.groupConfig.HBOPConfigPaymode[0].OPCharge || [],  // 其他付款方式
                        payType: res.groupConfig.HBOPConfigPaymode[0].OPCharge[0].paywID || '',
                        otherPay: res.groupConfig.HBOPConfigPaymode[0].OPCharge[1].paywID || '',

                    }, () => {
                        this.payChange() // 支付改变

                    });


                }
            }
        });
    }

    payChange = () => { // 支付改变
        let { otherPay, payType, otherPayData, radio } = this.state

        let otherPayCode = otherPayData.filter((item, i) => {
            return item.paywID === otherPay
        })

        let payTypeCode = otherPayData.filter((item, i) => {
            return item.paywID === payType
        })

        if (radio === 1) { // 单一支付
            otherPayCode = [{}]
        }

        if (otherPayCode[0].paywCode === 'CASH' || payTypeCode[0].paywCode === 'CASH') {  //合作记账单位
            this.setState({ disXJ: true })
        } else {
            this.setState({ disXJ: false })
        }

        if (otherPayCode[0].paywCode === 'ACC' || payTypeCode[0].paywCode === 'ACC') {  //院内账户
            this.setState({ ynDis: true })
        } else {
            this.setState({ ynDis: false })
        }

        if (otherPayCode[0].paywCode === 'CCP' || payTypeCode[0].paywCode === 'CCP') {  //合作记账单位
            this.setState({ hzDis: true })
        } else {
            this.setState({ hzDis: false })
        }
    }

    // 其他支付方式
    otherPay = (e) => {
        this.setState({ otherPay: e }, () => {

            this.payChange()
            this.xJ(this.state.xJ)
            setTimeout(() => {
                this.myRef4.current.focus();
            }, 300)
        });
    }

    // 支付方式
    payType = (e) => {
        let { otherPayData } = this.state
        this.setState({ payType: e }, () => {
            this.payChange()
            this.xJ(this.state.xJ)

            let payTypeCode = otherPayData.filter((item, i) => {
                return item.paywID === e
            })

            if (payTypeCode[0].paywCode === 'CASH' && this.state.radio === 1) { // 现金
                setTimeout(() => {
                    this.myRef5.current.focus();
                }, 300)
            }
            if (this.state.radio === 2) {
                setTimeout(() => {
                    this.myRef2.current.focus();
                }, 300)
            }
        });
    }

    // 合作单位
    unitsListVal = (e) => {
        this.setState({ unitsListVal: e });
    }

    // 单选
    onChangeRadio = (e) => {
        this.setState({ radio: e.target.value, }, () => {
            if (this.state.radio === 2) {
                this.setState({
                    dxDis: true,
                    dis1: true,
                })
            } else {
                this.setState({
                    dxDis: false,
                    dis1: false,
                })
            }
            this.setState({
                otherPayMoney: '0.00', // 其他支付金额
                cashInCashVal: '0.00', // 支付金额
            })
            this.xJ(this.state.xJ)
            this.payChange()
            setTimeout(() => {
                this.myRef1.current.focus();
            }, 300)
        });
    }

    // 支付金额现金
    cashInCash = (e) => {
        let val = e.target.value
        let { moneyData, otherPay2, otherPayMoney2 } = this.state
        if (val === '') {
            val = '0'
        }

        if (Keup.MoneyReplace(val) === '') {
            this.setState({
                cashInCashVal: Keup.MoneyReplace(val) // 金额过滤
            }, () => {
                this.xJ(this.state.xJ)
            })
            return false
        }

        if (parseFloat(Keup.MoneyReplace(val)) > parseFloat(moneyData.otherPayAmt)) {
            this.setState({
                cashInCashVal: parseFloat(moneyData.otherPayAmt).toFixed(2), // 其他支付金额
            }, () => {
                if (otherPay2) {
                    this.state.otherPayMoney2 = '0.00'; // 其他支付金额2
                }
                this.setState({
                    otherPayMoney: '0.00', // 其他支付金额
                }, () => {
                    this.xJ(this.state.xJ)
                })
            })
            return false
        }
        let otherPayMoneyFloat = parseFloat(parseFloat(moneyData.otherPayAmt) - parseFloat(Keup.MoneyReplace(val)) - (otherPay2 && otherPayMoney2 ? parseFloat(otherPayMoney2) : 0)).toFixed(2);
        if (otherPay2 && otherPayMoneyFloat < 0) { // 当输入的现金金额大于总金额减去其他金额2的话其他金额1为0，现金金额为总金额减去其他金额2
            this.state.cashInCashVal = (parseFloat(moneyData.otherPayAmt) - parseFloat(otherPayMoney2)).toFixed(2);
        } else {
            this.state.cashInCashVal = Keup.MoneyReplace(val);
        }
        this.setState({
            otherPayMoney: otherPayMoneyFloat < 0 ? '0.00' : otherPayMoneyFloat, // 其他支付金额
        }, () => {
            this.xJ(this.state.xJ)
        })
    }

    // 其他支付方式金额
    otherPayMoney = (e) => {
        let val = e.target.value
        let { moneyData, cashInCashVal, otherPay2, otherPayMoney2 } = this.state;
        if (val === '') {
            val = '0'
        }
        if (Keup.MoneyReplace(val) === '') {
            this.setState({ otherPayMoney: Keup.MoneyReplace(val) }, () => {
                this.xJ(this.state.xJ)
            });
            return false
        }

        if (parseFloat(Keup.MoneyReplace(val)) > parseFloat(moneyData.otherPayAmt)) {
            this.setState({
                otherPayMoney: parseFloat(moneyData.otherPayAmt).toFixed(2), // 其他支付金额
            }, () => {
                if (otherPay2) {
                    this.state.otherPayMoney2 = '0.00'; // 其他支付金额2
                }
                this.state.cashInCashVal = '0.00'; // 现金支付金额
                this.setState({}, () => {
                    this.xJ(this.state.xJ)
                })
            })
            return false
        }

        if (otherPay2) {
            let otherPayMoney2Float = parseFloat(parseFloat(moneyData.otherPayAmt) - parseFloat(this.state.cashInCashVal).toFixed(2) - parseFloat(val)).toFixed(2);
            console.log('otherPayMoney2Float', typeof (otherPayMoney2Float))
            if (otherPayMoney2Float < 0) {
                this.state.otherPayMoney = (parseFloat(moneyData.otherPayAmt) - parseFloat(cashInCashVal) - parseFloat(otherPayMoney2)).toFixed(2);
            } else {
                this.state.otherPayMoney = Keup.MoneyReplace(val);
                this.state.otherPayMoney2 = otherPayMoney2Float < 0 ? '0.00' : otherPayMoney2Float; // 其他支付金额2
            }
        } else {
            this.state.otherPayMoney = Keup.MoneyReplace(val);
            this.state.cashInCashVal = parseFloat(parseFloat(moneyData.otherPayAmt) - parseFloat(Keup.MoneyReplace(val))).toFixed(2); // 现金支付金额
        }
        this.setState({}, () => {
            this.xJ(this.state.xJ)
        })
    }

    // 其他支付方式2
    handleOtherPay2Change = (e) => {
        let { moneyData, cashInCashVal, otherPayMoney, otherPayMoney2 } = this.state;
        if (!e) { // 取消支付方式二则清除对应的金额
            this.state.otherPayMoney2 = '0.00';
        } else if (otherPayMoney2 !== '0.00') {
            this.state.otherPayMoney2 = parseFloat(parseFloat(moneyData.otherPayAmt) - parseFloat(cashInCashVal) - parseFloat(otherPayMoney)).toFixed(2);
        }
        this.setState({ otherPay2: e }, () => {
            this.payChange()
            this.xJ(this.state.xJ)
            setTimeout(() => {
                this.myRef7.current.focus();
            }, 300)
        });
    }

    handleOtherPayMoney2Change = (e) => {
        let val = e.target.value
        let { moneyData } = this.state

        if (val === '') {
            val = '0'
        }
        if (Keup.MoneyReplace(val) === '') {
            this.setState({ otherPayMoney2: Keup.MoneyReplace(val) }, () => {
                this.xJ(this.state.xJ)
            });
            return false
        }

        if (parseFloat(Keup.MoneyReplace(val)) > parseFloat(moneyData.otherPayAmt)) {
            this.setState({
                otherPayMoney2: parseFloat(moneyData.otherPayAmt).toFixed(2), // 其他支付金额
            }, () => {
                this.setState({
                    cashInCashVal: '0.00', // 支付方式金额
                    otherPayMoney: '0.00', // 其他支付金额
                }, () => {
                    this.xJ(this.state.xJ)
                })
            })
            return false
        }
        let otherPayMoney2 = parseFloat(parseFloat(moneyData.otherPayAmt) - parseFloat(cashInCashVal) - parseFloat(otherPayMoney)).toFixed(2);
        this.setState({ otherPayMoney2: otherPayMoney2 < 0 ? '0.00' : otherPayMoney2 }, () => {
            this.xJ(this.state.xJ)
        });
    }

    //现金
    xJ = (e) => {
        let val = e
        let { moneyData, otherPay, otherPay2, payType, radio, otherPayData } = this.state
        this.setState({
            xJ: Keup.MoneyReplace(val) // 金额过滤
        }, () => {

            let money = 0;

            if (radio === 1) {
                this.setState({
                    zeroPay: parseFloat(parseFloat(this.state.xJ) - parseFloat(moneyData.otherPayAmt)).toFixed(2)// 找零
                })
                return false
            }

            let otherPayCode = otherPayData.filter((item, i) => {
                return item.paywID === otherPay
            })

            let payTypeCode = otherPayData.filter((item, i) => {
                return item.paywID === payType
            })

            if (otherPayCode[0].paywCode === 'CASH') {
                money += parseFloat(this.state.otherPayMoney)
            }

            if (payTypeCode[0].paywCode === 'CASH') {
                money += parseFloat(this.state.cashInCashVal)
            }
            if (otherPay2) {
                let otherPayCode2 = otherPayData.filter((item, i) => {
                    return item.paywID === otherPay2
                })

                if (otherPayCode2[0].paywCode === 'CASH') {
                    money += parseFloat(this.state.otherPayMoney2)
                }
            }

            this.setState({
                zeroPay: parseFloat(parseFloat(this.state.xJ) - parseFloat(money)).toFixed(2)// 找零
            })
        })
    }

    // maypay 收费数据循环
    maypay = (chargeRecodeStr) => {
        var data = {
            params: [{
                "chargeRecodeStr": chargeRecodeStr,
            }]
        }
        $http.post('urlS', this, {
            code: "05210035",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    this.setState({
                        maypayData: res.chargeAmtInfo[0].paywArr || [],
                        accPurPoseList: res.accPurPoseList || "",
                        moneyData: res.chargeAmtInfo[0], //金额对象
                        payableAmt: res.chargeAmtInfo[0].otherPayAmt, //金额
                        // accountPayWayId: res.chargeAmtInfo[0].paywAccID, // 院内账户支付方式id
                        // payWayCashId: res.chargeAmtInfo[0].paywCashID, // 现金支付方式id
                        cashInCashVal: '0.00',
                        zeroPay: '0.00',
                        otherPayMoney: '0.00',
                    })
                }
            }
        });
    }

    // 金额
    money = (chargeRecodeStr) => {
        var data = {
            params: [{
                "recodeIDStr": chargeRecodeStr || '', // 交款记录id
            }]
        }
        $http.post('urlADS', this, {
            code: "05210008",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    this.setState({

                    })
                }
            }
        });
    }

    // chargingConfirMessage = () => {  // 现金提示
    //     const { radio, zeroPay } = this.state
    //     if (parseFloat(zeroPay) < 0) {
    //         Keup.ModalMessage(3, this, '实付现金小于应付现金，请注意确认!', '自动关闭', 'destroy', '确定', 'warning')
    //     }
    // }

    chargingConfirError = () => {  // 收费确认前验证
        const { otherPayMoney2, moneyData, cashInCashVal, otherPayData, payType, otherPayMoney, otherPay, radio, zeroPay, unitsListVal, patID } = this.state
        let money = 0;
        let otherPayCode = otherPayData.filter((item, i) => {
            return item.paywID === otherPay
        })

        let payTypeCode = otherPayData.filter((item, i) => {
            return item.paywID === payType
        })
        if (radio === 1) {
            if (payTypeCode[0].paywCode === 'ACC') {//院内账户
                if (parseFloat(this.state.moneyData.accountAmt) < parseFloat(moneyData.otherPayAmt)) {
                    message.error('院内账户余额不足！')
                    return false
                }
                this.childRegister.CheckCPPAmt({ patID: patID, cppAmt: moneyData.otherPayAmt }, (rtn) => {
                    if (!rtn.CheckCPPFlag) {
                        message.error(rtn.errorMessage)
                        return false
                    }
                })
            }
            money += parseFloat(this.state.moneyData.otherPayAmt)
        }
        if (radio === 2) {
            if (payTypeCode[0].paywCode === 'ACC' || otherPayCode[0].paywCode === 'ACC') {//院内账户
                if (parseFloat(this.state.moneyData.accountAmt) < parseFloat(moneyData.otherPayAmt)) {
                    message.error('院内账户余额不足！')
                    return false
                }
            }

            if (parseFloat(parseFloat(otherPayMoney2) + parseFloat(otherPayMoney) + parseFloat(cashInCashVal)).toFixed(2) < parseFloat(moneyData.otherPayAmt).toFixed(2)) {
                message.error('付款金额小于应收金额！')
                return false
            }
        }

        if (otherPayCode[0].paywCode === 'CCP' || payTypeCode[0].paywCode === 'CCP') {  //合作记账单位
            if (unitsListVal === '' || !unitsListVal) {
                message.error('请选择合作医院!')
                return false
            }
        }

        if (otherPayCode[0].paywCode === 'CASH') { // 现金
            money += parseFloat(this.state.otherPayMoney)
        }

        if (payTypeCode[0].paywCode === 'CASH') {
            money += parseFloat(this.state.cashInCashVal)
        }

        if (this.state.disXJ) {
            if (parseFloat(this.state.xJ) > 0 && this.state.xJ != '' && parseFloat(parseFloat(this.state.xJ) - parseFloat(money)) < 0) {
                message.error('实付现金小于应付现金，请注意确认!')
                return false
            }
        }
        return true
    }

    // 收费确认
    chargingConfir = () => {
        const { payWayCashId, moneyData, cashInCashVal, payType, otherPayMoney, otherPay, radio, zeroPay, unitsListVal, accPurPoseList, otherPay2, otherPayMoney2 } = this.state
        let paywIDinfo;
        if (radio === 1) {
            paywIDinfo = payType + '^' + moneyData.otherPayAmt
        }
        if (radio === 2) {
            paywIDinfo = payType + '^' + cashInCashVal + String.fromCharCode('2') + otherPay + '^' + otherPayMoney + String.fromCharCode('2') + (otherPay2 ? (otherPay2 + '^' + otherPayMoney2) : '');
        }
        ///用途记账支付金额
        for (var i = 0; i < accPurPoseList.length; i++) {

            if (accPurPoseList[i] && accPurPoseList[i].accPurPosePayamt) {
                if (parseFloat(accPurPoseList[i].accPurPosePayamt) != 0) {
                    paywIDinfo = accPurPoseList[i].paywID + '^' + parseFloat(accPurPoseList[i].accPurPosePayamt) + String.fromCharCode('2') + paywIDinfo
                }
            }
        }
        var data1 = {
            params: [{
                "recordIDinfo": this.state.chargeRecodeId || '', // 交款记录id
                "userID": JSON.parse(window.sessionStorage.userData).userID || '', //收费员ID
                "sflag": "0", //是收费还是退费
                "accmID": this.state.moneyData.accountID.split('||')[0], //病人账户ID
                "paywIDinfo": paywIDinfo,
                "printflag": "Y",//是否打印发票
                unitID: unitsListVal,
            }]
        }

        var data2 = {
            params: [{
                "recordIDinfo": this.state.chargeRecodeId || '', // 交款记录id
                "userID": JSON.parse(window.sessionStorage.userData).userID || '', //收费员ID
                "sflag": "0", //是收费还是退费
                "accmID": this.state.moneyData.accountID.split('||')[0], //病人账户ID
                "paywIDinfo": '',//支付方式串 
                "printflag": "Y",//是否打印发票
                password: this.props.password ? this.props.password : undefined,
                personalData: this.props.personalData ? this.props.personalData : undefined,
            }]
        }

        $http.post('urlADS', this, {
            code: "05210024",
            data: data1,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    $http.post('urlADS', this, {
                        code: "05210007",
                        data: data2,
                        success: function (res) {
                            let errorCode = res.errorCode;
                            if (errorCode === '0') {
                                this.props.MakeMoney(res);
                            }
                        }
                    });

                }
            }
        });
    }

    accpurPoseevent = (event, accpurPoseCode) => {
        let value = event.target.value
        let newVal = Keup.MoneyReplace(value) // 金额过滤
        const newData = [...this.state.accPurPoseList];
        for (var i = 0; i < this.state.accPurPoseList.length; i++) {
            if (this.state.accPurPoseList[i].accpurPoseCode === accpurPoseCode) {
                let balance = this.state.accPurPoseList[i].balance
                if (parseFloat(Keup.MoneyReplace(value)) > parseFloat(balance)) {
                    newVal = balance
                    message.error('输入的金额大于余额，请注意确认!')
                }
                if (newData[i] && newData[i].accPurPosePayamt) {
                    newData[i].accPurPosePayamt = newVal;
                } else {
                    newData[i] = { ...this.state.accPurPoseList[i], accPurPosePayamt: newVal }
                }
            }
        }
        this.setState({ accPurPoseList: newData }, () => {
            setTimeout(() => {
                this.checkotherPayAmt();
            }, 1)
        }
        );
    }

    //检查应付金额
    checkotherPayAmt = () => {
        const newmoneyData = { ...this.state.moneyData };
        let accPurPosePayamt = 0 	//用途金额
        for (var i = 0; i < this.state.accPurPoseList.length; i++) {
            if (this.state.accPurPoseList[i] && this.state.accPurPoseList[i].accPurPosePayamt) {
                accPurPosePayamt = accPurPosePayamt + parseFloat(this.state.accPurPoseList[i].accPurPosePayamt)
            }
        }
        newmoneyData.otherPayAmt = parseFloat(parseFloat(this.state.payableAmt) - parseFloat(accPurPosePayamt)).toFixed(2)
        this.setState({
            moneyData: newmoneyData,
            dxDis: false,
            dis1: false,
            otherPayMoney: '0.00', // 其他支付金额
            cashInCashVal: '0.00',
        });
    }

    onRefCashRegister = (ref) => {
        this.childRegister = ref
    }

    render() {
        const { otherPay2 } = this.state;
        return (
            <div className='patpay-way-body'>
                <OtherCashRegister onRef={this.onRefCashRegister}></OtherCashRegister>
                <Row className='mT10'>
                    {this.state.maypayData.map((item, i) =>
                        <Col span={12} key={i}>
                            <Row className='mT10'>
                                <Col span={10} className='modalLabel '>{item.desc}</Col>
                                <Col span={14} >
                                    <Input value={item.amt} disabled={true} className='input' addonBefore="￥" onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }} />
                                </Col>
                            </Row>
                        </Col>
                    )}
                </Row>

                {this.state.accPurPoseList && this.state.accPurPoseList.length > 0 ? <div>
                    <Divider dashed style={{ margin: '12px' }}>病人用途余额</Divider>
                    <Row>
                        <Col span={24}>
                            {/* 遍历 */}
                            {this.state.accPurPoseList && this.state.accPurPoseList.map((item, index) => {
                                return (
                                    <Row style={{ height: "12px" }} key={index}>
                                        <Col span={5} className='modalLabel '>{item.accpurPoseDesc}用途：</Col>
                                        <Col span={9} style={{ textAlign: "center", height: "10px", lineHeight: "25px" }}>
                                            <Input value={item.balance} disabled={true} className='input' addonBefore="余额" />
                                        </Col>
                                        <Col span={9} offset={1} >
                                            <Input value={item.accPurPosePayamt ? item.accPurPosePayamt : ''} className='input' addonBefore="￥" onChange={(event) => { this.accpurPoseevent(event, item.accpurPoseCode) }} onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }} onPressEnter={() => {
                                                if (this.state.disXJ) {
                                                    setTimeout(() => {
                                                        this.myRef5.current.focus();
                                                    }, 300)
                                                } else {
                                                    this.props.handthis.payButtonOk();
                                                }
                                            }} />
                                        </Col>
                                    </Row>
                                )
                            })}
                        </Col>
                    </Row>
                </div> : ""}
                <Divider dashed style={{ margin: '12px' }} />
                <Row className='mT10'>
                    <Col span={24}>
                        <Row className="mT5">
                            <Col span={5} className='modalLabel '>  <div className='registr-modal-fee' style={{ float: 'left' }}></div>应收（元）：</Col>
                            <Col span={19} >
                                <Input value={this.state.moneyData.otherPayAmt || '0.00'} disabled={true} className='input' addonBefore="￥" onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }} />
                            </Col>
                        </Row>
                        <Row className="mT5">
                            <Col span={5} className='modalLabel '>支付方式：</Col>
                            <Col span={9} >
                                <Select ref={this.myRef1} showSearch optionFilterProp="title" placeholder="请选择付款方式" style={{ width: '100%' }} value={this.state.payType} onSelect={(event) => { this.payType(event) }}  >
                                    {this.state.otherPayData.map(item => <Option title={item.paywDesc + '^' + item.paywCode} key={item.paywID} value={item.paywID}  >{item.paywDesc}</Option>)}
                                </Select>
                            </Col>
                            <Col span={9} offset={1} style={{ display: this.state.dis1 ? 'block' : 'none' }} >
                                <Input ref={this.myRef2} className='input' addonBefore="￥" onChange={(e) => { this.cashInCash(e); }} value={this.state.cashInCashVal} onBlur={(event) => { if (event.target.value === '') { event.target.value = '0.00' } this.setState({ cashInCashVal: parseFloat(event.target.value).toFixed(2) }) }} onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }} onPressEnter={() => {
                                    setTimeout(() => {
                                        this.myRef3.current.focus();
                                    }, 300)
                                }} />
                            </Col>
                        </Row>
                        <Row className="mT5" style={{ display: this.state.dxDis ? 'block' : 'none' }}>
                            <Col span={5} className='modalLabel '>其他支付方式：</Col>
                            <Col span={9} >
                                <Select ref={this.myRef3} showSearch optionFilterProp="title" placeholder="请选择付款方式" style={{ width: '100%' }} value={this.state.otherPay} onSelect={(event) => { this.otherPay(event) }}  >
                                    {this.state.otherPayData.map(item => <Option title={item.paywDesc + '^' + item.paywCode} key={item.paywID} value={item.paywID}  >{item.paywDesc}</Option>)}
                                </Select>
                            </Col>
                            <Col span={9} offset={1} style={{ display: this.state.dis1 ? 'block' : 'none' }} >
                                <Input ref={this.myRef4} className='input' addonBefore="￥" onChange={(e) => { this.otherPayMoney(e); }} value={this.state.otherPayMoney} onBlur={(event) => { if (event.target.value === '') { event.target.value = '0.00' } this.setState({ otherPayMoney: parseFloat(event.target.value).toFixed(2) }) }} onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }} onPressEnter={() => {
                                    if (this.state.disXJ) {
                                        setTimeout(() => {
                                            this.myRef6.current.focus();
                                        }, 300)
                                    } else {
                                        this.props.handthis.payButtonOk();
                                    }
                                }} />
                            </Col>
                        </Row>
                        <Row className="mT5" style={{ display: this.state.dxDis ? 'block' : 'none' }}>
                            <Col span={5} className='modalLabel '>其他支付方式：</Col>
                            <Col span={9} >
                                <Select
                                    allowClear
                                    ref={this.myRef6}
                                    showSearch
                                    optionFilterProp="title"
                                    placeholder="请选择付款方式"
                                    style={{ width: '100%' }}
                                    value={otherPay2}
                                    onChange={this.handleOtherPay2Change}
                                >
                                    {this.state.otherPayData.map(item => <Option title={item.paywDesc + '^' + item.paywCode} key={item.paywID} value={item.paywID}  >{item.paywDesc}</Option>)}
                                </Select>
                            </Col>
                            <Col span={9} offset={1} style={{ display: this.state.dis1 ? 'block' : 'none' }} >
                                <Input
                                    allowClear
                                    ref={this.myRef7}
                                    className='input'
                                    addonBefore="￥"
                                    disabled={!otherPay2}
                                    onChange={this.handleOtherPayMoney2Change}
                                    value={this.state.otherPayMoney2}
                                    onBlur={(event) => { if (event.target.value === '') { event.target.value = '0.00' } this.setState({ otherPayMoney2: parseFloat(event.target.value).toFixed(2) }) }}
                                    onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }}
                                    onPressEnter={() => {
                                        if (this.state.disXJ) {
                                            setTimeout(() => {
                                                this.myRef5.current.focus();
                                            }, 300)
                                        } else {
                                            this.props.handthis.payButtonOk();
                                        }
                                    }}
                                />
                            </Col>
                        </Row>
                        <Row className="mT5" style={{ display: this.state.ynDis ? 'block' : 'none' }} >
                            <Col span={24} style={{ textAlign: 'center' }}>
                                <Icon type="warning" style={{ color: 'rgb(250, 140, 22)' }} /> 注：院内账户余额<span style={{ color: '#1999db' }}>￥{this.state.moneyData.accountAmt}</span> &nbsp; &nbsp;账户状态:<span style={{ color: '#1999db' }}>{this.state.moneyData.accountFlagDesc}</span> <span style={{ color: "red", display: parseFloat(this.state.moneyData.accountAmt) >= parseFloat(this.state.moneyData.otherPayAmt) ? "none" : 'block' }}>余额不足</span>
                            </Col>
                        </Row>
                    </Col>
                </Row>
                <Row className='mT10' style={{ display: this.state.disXJ ? 'block' : 'none' }}>
                    <Divider dashed={true}>实收现金</Divider>
                    <Col span={24}>
                        <Row className="mT5">
                            <Col span={5} className='modalLabel '>实收现金：</Col>
                            <Col span={19} >
                                <Input ref={this.myRef5} value={this.state.xJ} onChange={(e) => { this.xJ(e.target.value); }} className='input' addonBefore="￥" onBlur={(event) => { if (event.target.value === '') { event.target.value = '0.00' } this.setState({ xJ: parseFloat(event.target.value).toFixed(2) }) }} onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }} onPressEnter={() => { this.props.handthis.payButtonOk(); }} />
                            </Col>
                        </Row>
                        <Row className="mT5">
                            <Col span={5} className='modalLabel '> <div className='registr-fee-change' style={{ float: 'left' }} ></div>找零（元）：</Col>
                            <Col span={19} >
                                <Input value={parseFloat(this.state.zeroPay) > 0 ? this.state.zeroPay : '0.00'} disabled={true} className='input' addonBefore="￥" onFocus={(event) => { if (event.target.value === '0.00') { event.target.value = '' } }} />
                            </Col>
                        </Row>
                    </Col>
                </Row>
                <Row className='mT10' style={{ display: this.state.hzDis ? 'block' : 'none' }}>
                    <Divider dashed={true}>合作单位</Divider>
                    <Col span={4} className='modalLabel '>合作单位：</Col>
                    <Col span={20} >
                        <Select allowClear showSearch optionFilterProp="title" placeholder="请选择合作协作医院" style={{ width: '100%' }} value={this.state.unitsListVal} onSelect={(event) => { this.unitsListVal(event) }}  >
                            <Option value=''>请选择</Option>
                            {this.state.unitsList.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                        </Select>
                    </Col>
                </Row>
                <Divider dashed={true} />
                <Row className='mT10' style={{ background: '#fefefe' }}>
                    <span style={{ marginRight: '20px' }}>切换支付方式</span>
                    <Radio.Group onChange={this.onChangeRadio} value={this.state.radio} >
                        <Radio value={1}>单一支付</Radio>
                        <Radio value={2}>组合支付</Radio>
                    </Radio.Group>
                </Row>
            </div>
        )
    }
}